package itanty.aop05;

import com.itanty.exception.UserExistException;
import com.itanty.exception.UserNotExistException;

/**
 * @author 石小俊
 */
public class UserServiceImpl implements UserService {
    @Override
    public String register(String username,String password,String phone,String address) throws UserExistException {
        System.out.println("UserServiceImpl.register");
        if("admin".equals(username)){
            throw new UserExistException("该用户已经被注册");
        }
        return "用户名可用";
    }

    @Override
    public String login(String username,String password) throws UserNotExistException {
        System.out.println("UserServiceImpl.login");
        if("admin".equals(username) && "123456".equals(password)){
            return "登录成功";
        }
        throw new UserNotExistException("用户名或密码错误");
    }

    @Override
    public void doSome() {
        System.out.println("UserServiceImpl.doSome");
    }

    @Override
    public void doOther() {
        System.out.println("UserServiceImpl.doOther");
    }
}
